/* =============================================
 * Project: fsutil
 * =============================================
 * Package: com.pti.fsc.common.vo
 *
 *
 * Copyright 2017 Premium Technology, Inc. All rights reserved.
 * PremiumIT PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * WWW: http://www.premiumIT.com
 * Contact us: info@premiumIT.com
 * =============================================
 */
package com.pti.waf.util.ui;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.pti.util.StringUtil;

/**
 * @author llu
 * 
 */
public class PageLayout extends FormConfig implements Serializable {
	private static final long serialVersionUID = -522077970232281262L;
	/*
	 * form configuration
	 */
	private Map<String, FormConfig> formConfigs;

	private AsideConfig asideConfig;
	
	public Map<String, FormConfig> getFormConfigs() {
		return formConfigs;
	}

	public void setFormConfigs(Map<String, FormConfig> formConfigs) {
		this.formConfigs = formConfigs;
	}

	public AsideConfig getAsideConfig() {
		return asideConfig;
	}

	public void setAsideConfig(AsideConfig asideConfig) {
		this.asideConfig = asideConfig;
	}

	public FormConfig addFormConfig(String name) {
		if (StringUtil.isEmpty(name)) {
			return null;
		}
		if (formConfigs == null) {
			formConfigs = new HashMap<String, FormConfig>();
			FormConfig formConfig = new FormConfig();
			formConfig.setName(name);
			formConfigs.put(name, formConfig);
		} else if (formConfigs.get(name) == null) {
			FormConfig formConfig = new FormConfig();
			formConfig.setName(name);
			formConfigs.put(name, formConfig);
		}
		return formConfigs.get(name);
	}
}
